package org.mtmi.midi;

import org.mtmi.tuio.listeners.TUIOTapEvent;
import org.mtmi.ui.M;
import org.mtmi.ui.controls.Button;
import org.mtmi.ui.scenes.Scene;

import rwmidi.MidiOutput;


public class SendMidiSysExButton extends Button  {

	byte sysExMessage[];
	MidiOutput midiOutput;
	
	
	public MidiOutput getMidiOutput() {
		return midiOutput;
	}
	
	public void setMidiOutput(MidiOutput midiOutput) {
		this.midiOutput = midiOutput;
	}
	
	public SendMidiSysExButton(Scene scene) {
		super(scene, M.SCENE_CONTROL);
	}
	
	public SendMidiSysExButton(Scene scene, byte message[]) {
		super(scene, M.SCENE_CONTROL);
		this.sysExMessage = message;
	}
	
	public byte[] getSysExMessage() {
		return sysExMessage;
	}
	
	public void setSysExMessage(byte message[]) {
		this.sysExMessage = message;
	}
	
	

	private void sendSysExMessage() {
		midiOutput.sendSysex(sysExMessage);
	}
	
	@Override
	public void tapDown(TUIOTapEvent event) {
		super.tapDown(event);
		sendSysExMessage();
	}
	


}
